import { Message, MessageBox } from 'element-ui'

// 成功消息提示
export const alterSuccess = msg => {
  Message.success({
    message: msg,
    duration: 1500,
    center: true
  })
}

// 失败消息提示
export const alterError = msg => {
  Message.error({
    message: msg,
    duration: 1500,
    center: true
  })
}

// 确认弹框
export const confirmMsg = (callback, tips = '是否确认删除?', faill) => {
  MessageBox.confirm(tips, '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  })
    .then(async () => {
      callback()
    })
    .catch(() => {
      // 取消的提示
      if (faill) {
        faill()
      }
    })
}
